<{include file="../common/iframe_header.tpl"}>
<link href="//unpkg.com/layui@2.11.5/dist/css/layui.css" rel="stylesheet">
<script src="//unpkg.com/layui@2.11.5/dist/layui.js"></script>
<div class="pad_10" style="margin-top: 40px;">
    <div class="table-list">
        <div class="common-form">
            <button type="button" class="layui-btn layui-btn-normal" id="uploadify">选择文件</button>
            <button type="button" class="layui-btn" id="ID-upload-demo-action">开始上传</button>
            <div class="layui-progress layui-progress-big" lay-showPercent="true" lay-filter="demo-filter-progress">
                <div class="layui-progress-bar" lay-percent="0%"></div>
            </div>
            <div>请选择ZIP文件包，包内文件名需以“网点编号-文字描述.后缀”命名</div>
            </form>
        </div>
    </div>
    <br/>
    <div class="table-list">
        <table width="100%">
            <thead>
            <tr>
                <th>ZIP文件名</th>
                <th>上传时间</th>
                <th>银行名称</th>
                <th>处理情况</th>
                <th>删除</th>
            </tr>
            </thead>
            <tbody>
            <{foreach $list as $key => $val}>
                <tr onMouseOver="this.className = 'tr2'" onMouseOut="this.className = 'tr1'" class="tr1" id="nba_<{$val.nba_id}>">
                    <td><{$val.zip_name}></td>
                    <td><{$val.create_time}></td>
                    <td><{$bank_info.bank_name}></td>
                    <td><{$val.remark}></td>
                    <td><a href="javascript:;" onclick="del(<{$val.nba_id}>);">删除</a></td>
                </tr>
                <{/foreach}>
            </tbody>
        </table>

        <div style="float:right;"><{$page}></div>
    </DIV>
</div>

<script type="text/javascript">
    layui.use(function(){
        var upload = layui.upload;
        var element = layui.element;
        var layer = layui.layer;
        // 渲染
        upload.render({
            data: {'bank_id' : '<{$bank_id}>'},
            dataType :'text',
            elem: '#uploadify',
            url: '/webadmin/attach/BankZip',
            auto: false,
            field:'upfile',
            size:600000,
            accept:'file',
            acceptMime:'application/zip,application/x-rar-compressed',
            // multiple: true,
            bindAction: '#ID-upload-demo-action',
            progress: function(n, elem, res, index){
                var percent = n + '%' // 获取进度百分比
                element.progress('demo-filter-progress', percent); // 可配合 layui 进度条元素使用
            },
            done: function(res, index, upload){
                console.log(res);
                var obj = eval('(' + res + ')');
                if (obj.state == 'SUCCESS') {
                    layer.confirm('上传成功',{
                        btn: ['确定'] //按钮
                    }, function(){
                        window.location.reload();
                    });


                } else {
                    layer.msg(obj.error);
                }
            }
        });
    });

    function del(nba_id){
        if (confirm('确认删除？')) {
            $.getJSON('/webadmin/network/DelBankAttach',{nba_id:nba_id},function(res){
                if (res.status==1) {
                    $('#nba_'+nba_id).remove();
                    //alert(res.note);
                    layer.msg(res.note);
                } else {
                    //alert(res.note);
                    layer.msg(res.note);
                }
            });
        }

    }
</script>
<{include file="../common/footer.tpl"}>